//
//  MyMarkViewController.m
//  QXShowing
//
//  Created by 王道道 on 2018/7/21.
//  Copyright © 2018年 doll_dream. All rights reserved.
//

#import "MyMarkViewController.h"

#import "VTMagicController.h"

#import "MyLookViewController.h"
#import "LookMeViewController.h"

static NSString *const listVC1 = @"listVC1";
static NSString *const listVC2 = @"listVC2";

@interface MyMarkViewController ()<VTMagicViewDelegate,VTMagicViewDataSource>
@property (nonatomic, strong) VTMagicController *magicController;

@end

@implementation MyMarkViewController

#pragma mark - Lazy
- (VTMagicController *)magicController {
    if (_magicController == nil) {
        _magicController = [[VTMagicController alloc]init];
        _magicController.magicView.frame = CGRectMake(0, 0, App_Frame_Width, App_Frame_Height - kNavbarAndStatusBar);
        _magicController.magicView.navigationColor = [UIColor whiteColor];
        _magicController.magicView.backgroundColor = [UIColor whiteColor];
        _magicController.magicView.layoutStyle = VTLayoutStyleDivide;
        _magicController.magicView.switchStyle = VTSwitchStyleDefault;
        _magicController.magicView.sliderColor = Main_Color;
        _magicController.magicView.itemScale = 1.2;
        _magicController.magicView.sliderWidth = 20;
        _magicController.magicView.sliderHeight = 3;
        _magicController.magicView.scrollEnabled = YES;
        _magicController.magicView.delegate = self;
        _magicController.magicView.dataSource = self;
    }
    return _magicController;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"浏览足迹";
    [self initNavBarBackBtn];

    [self addChildViewController:self.magicController];
    [self.view addSubview:self.magicController.magicView];
    [self.magicController.magicView reloadData];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (UIButton *)magicView:(VTMagicView *)magicView menuItemAtIndex:(NSUInteger)itemIndex {
    static NSString *itemIdentifier = @"itemIdentifier";
    UIButton *menuItem = [magicView dequeueReusableItemWithIdentifier:itemIdentifier];
    if (!menuItem) {
        menuItem = [UIButton buttonWithType:UIButtonTypeCustom];
        [menuItem setTitleColor:Text_Color_333333 forState:UIControlStateNormal];
        [menuItem setTitleColor:Main_Color forState:UIControlStateSelected];
        menuItem.titleLabel.font = [UIFont fontWithName:@"Helvetica" size:16.f];
    }
    return menuItem;
}

- (NSArray<NSString *> *)menuTitlesForMagicView:(VTMagicView *)magicView {
    return @[@"我看过谁的",@"谁看过我的"];
}

- (UIViewController *)magicView:(VTMagicView *)magicView viewControllerAtPage:(NSUInteger)pageIndex {
    if (pageIndex == 0) {
        MyLookViewController *listVCa = [magicView dequeueReusablePageWithIdentifier:listVC1];
        if (!listVCa) {
            listVCa = [[MyLookViewController alloc] init];
        }
        return listVCa;
    } else {
        LookMeViewController *listVCb = [magicView dequeueReusablePageWithIdentifier:listVC2];
        if (!listVCb) {
            listVCb = [[LookMeViewController alloc] init];
        }
        return listVCb;
    }
}


- (void)magicView:(VTMagicView *)magicView viewDidAppear:(__kindof UIViewController *)viewController atPage:(NSUInteger)pageIndex {
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
